#include "paymainwindow.h"
#include "ui_paymainwindow.h"
#include<QPixmap>
#include "carmainwindow.h"
PayMainWindow::PayMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::PayMainWindow)
{
    ui->setupUi(this);

    QPixmap pimax = QPixmap("3.bmp");
    pimax = pimax.scaled(ui->label_pay->size());
    ui->label_pay->setPixmap(pimax);
}

PayMainWindow::~PayMainWindow()
{
    delete ui;

}

void PayMainWindow::setData(QString carId, QString enterTimeStr, QString lastTime, int secs, double money)
{

    ui->textBrowser->append("车牌号：");
    ui->textBrowser->append(carId);
    ui->textBrowser->append("进场时间：");
    ui->textBrowser->append(enterTimeStr);
    ui->textBrowser->append("离场时间：");
    ui->textBrowser->append(lastTime);
    ui->textBrowser->append("停车时长(秒)：");
    ui->textBrowser->append(QString::number(secs));
    ui->textBrowser->append("停车费用(元)：");
    ui->textBrowser->append(QString::number( money));

    QString All = QString("停车时长：%1秒 - 停车费用：%2元").arg(QString::number(secs)).arg(QString::number( money));
    ui->lineEdit->setText(All);


}
//ok
void PayMainWindow::on_pushButton_clicked()
{
    //获取父窗口指针
    CarMainWindow *parent = dynamic_cast<CarMainWindow*>(this->parentWidget());
    parent->show();
    this->close();
}
